const mongoose = require('mongoose')
const db = require('./db')
const Schema = mongoose.Schema
    //创建一个规则
const userSchema = new mongoose.Schema({
    nick_name: { type: String, required: true },
    password: { type: String, required: true },
    email: { type: String, required: true },
    identity: { type: Number, required: true },
    date: { type: Date, required: true, default: Date.now },
    website: { type: String },
    sign: { type: String },
    avatar: { type: String, required: true, default: '/img/6.jpg' },
    loginNum: { type: Number, default: 1, required: true },
    articleList: [{ type: Schema.Types.ObjectId, ref: 'article_lists' }]
})

//创建一个模型
const userModel = db.model('user_lists', userSchema)
    //导出这个模型

module.exports = userModel